package listener_pattern;

import java.util.Scanner;

/**
 * @ClassName:
 * @Description:
 * @Author: LynnZou
 * @Date: 2017/6/16
 */
public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        System.out.println("请输入杂志内容：");
        while (true) {
            String line = s.nextLine();
            if (line.equals("exit")) break;
            publishingMagazine(line);
            System.out.println(">>>" + line);
        }
    }

    public static void publishingMagazine(String content){
        ServletContext sc = new ServletContext();
        sc.addObserver(new Listener("Jack"));
        sc.notifyObservers(content);
    }
}
